<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="EmpresasEditDlg" widgetVar="EmpresasEditDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.EditEmpresasTitle}">
            <h:form id="EmpresasEditForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{empresasController.selected != null}">
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_id}" for="id" />
                        <p:inputText id="id" value="#{empresasController.selected.id}" title="#{bundle.EditEmpresasTitle_id}" required="true" requiredMessage="#{bundle.EditEmpresasRequiredMessage_id}"/>
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_nome}" for="nome" />
                        <p:inputText id="nome" value="#{empresasController.selected.nome}" title="#{bundle.EditEmpresasTitle_nome}" required="true" requiredMessage="#{bundle.EditEmpresasRequiredMessage_nome}"/>
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_cnpj}" for="cnpj" />
                        <p:inputText id="cnpj" value="#{empresasController.selected.cnpj}" title="#{bundle.EditEmpresasTitle_cnpj}" required="true" requiredMessage="#{bundle.EditEmpresasRequiredMessage_cnpj}"/>
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_inscricaoEstadual}" for="inscricaoEstadual" />
                        <p:inputText id="inscricaoEstadual" value="#{empresasController.selected.inscricaoEstadual}" title="#{bundle.EditEmpresasTitle_inscricaoEstadual}" />
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_numero}" for="numero" />
                        <p:inputText id="numero" value="#{empresasController.selected.numero}" title="#{bundle.EditEmpresasTitle_numero}" />
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_fone}" for="fone" />
                        <p:inputText id="fone" value="#{empresasController.selected.fone}" title="#{bundle.EditEmpresasTitle_fone}" />
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_fax}" for="fax" />
                        <p:inputText id="fax" value="#{empresasController.selected.fax}" title="#{bundle.EditEmpresasTitle_fax}" />
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_logradouro}" for="logradouro" />
                        <p:selectOneMenu id="logradouro" value="#{empresasController.selected.logradouro}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{logradourosController.itemsAvailableSelectOne}"
                                           var="logradouroItem"
                                           itemValue="#{logradouroItem}"/>
                        </p:selectOneMenu>
                        <p:outputLabel value="#{bundle.EditEmpresasLabel_cidade}" for="cidade" />
                        <p:selectOneMenu id="cidade" value="#{empresasController.selected.cidade}" >
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{cidadesController.itemsAvailableSelectOne}"
                                           var="cidadeItem"
                                           itemValue="#{cidadeItem}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{empresasController.update}" value="#{bundle.Save}" update="display,:EmpresasListForm:datalist,:growl" oncomplete="handleSubmit(args, 'EmpresasEditDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="EmpresasEditDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
